Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set LC_ALL in translation test #256

Merged
merged 2 commits into from
Sep 20, 2023
Merged

Set LC_ALL in translation test #256

merged 2 commits into from
Sep 20, 2023

Conversation

lionel-
Copy link
Member

@lionel- lionel- commented Sep 19, 2023

Fixes these CRAN failures:

══ Failed tests ════════════════════════════════════════════════════════════════
  ── Failure ('test-po.R:7:3'): translation domain correctly loaded ──────────────
  withr::with_language("fr", hello()) (`actual`) not equal to "Bonjour" (`expected`).

  `actual`: "Hello"
  `expected`: "Bonjour"
  ── Failure ('test-po.R:36:3'): modifed translations are correctly reloaded ─────
  withr::with_language("fr", hello()) (`actual`) not equal to "Salut" (`expected`).

  `actual`: "Hello"
  `expected`: "Salut"

Kurt helpfully tracked down the failures to these changes in glibc:

*********************************************************************
commit 2897b231a6b71ee17d47d3d63f1112b2641a476c
Author: Bruno Haible <bruno@clisp.org>
Date:   Mon Sep 4 15:31:36 2023 +0200

    intl: Treat C.UTF-8 locale like C locale (BZ# 16621)

    The wiki page https://sourceware.org/glibc/wiki/Proposals/C.UTF-8
    says that "Setting LC_ALL=C.UTF-8 will ignore LANGUAGE just like it
    does with LC_ALL=C." This patch implements it.

    * intl/dcigettext.c (guess_category_value): Treat C.<encoding> locale
    like the C locale.

    Reviewed-by: Florian Weimer <fweimer@redhat.com>
*********************************************************************

via

*********************************************************************
  * debian/patches/any/git-c-utf-8-language.diff: backport support from
    upstream to treat C.<encoding> locale like C locale.  Closes: 874160.
*********************************************************************

Fixes:

```
══ Failed tests ════════════════════════════════════════════════════════════════
  ── Failure ('test-po.R:7:3'): translation domain correctly loaded ──────────────
  withr::with_language("fr", hello()) (`actual`) not equal to "Bonjour" (`expected`).

  `actual`: "Hello"
  `expected`: "Bonjour"
  ── Failure ('test-po.R:36:3'): modifed translations are correctly reloaded ─────
  withr::with_language("fr", hello()) (`actual`) not equal to "Salut" (`expected`).

  `actual`: "Hello"
  `expected`: "Salut"
```

Caused by these changes in glibc:

```
*********************************************************************
commit 2897b231a6b71ee17d47d3d63f1112b2641a476c
Author: Bruno Haible <bruno@clisp.org>
Date:   Mon Sep 4 15:31:36 2023 +0200

    intl: Treat C.UTF-8 locale like C locale (BZ# 16621)

    The wiki page https://sourceware.org/glibc/wiki/Proposals/C.UTF-8
    says that "Setting LC_ALL=C.UTF-8 will ignore LANGUAGE just like it
    does with LC_ALL=C." This patch implements it.

    * intl/dcigettext.c (guess_category_value): Treat C.<encoding> locale
    like the C locale.

    Reviewed-by: Florian Weimer <fweimer@redhat.com>
*********************************************************************

via

*********************************************************************
  * debian/patches/any/git-c-utf-8-language.diff: backport support from
    upstream to treat C.<encoding> locale like C locale.  Closes: 874160.
*********************************************************************
```
@@ -11,13 +11,21 @@ test_that("translation domain correctly loaded", {
})

test_that("modified translations are correctly reloaded", {
# Need to also specify `LC_ALL` because `LANGUAGE` is ignored when
# `LANG` is set (here via `LC_ALL`) to `C` or `C.UTF-8`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this go upstream into withr too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the upstream change: r-lib/withr@687f3a3

It's only giving a warning as the caller needs to set the locale.

@lionel- lionel- merged commit 028b4d5 into main Sep 20, 2023
12 checks passed
@lionel- lionel- deleted the fix-language-test branch September 20, 2023 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants